import router from './router/index'
import store from './store/index'
const permissionRoute = [
    '/cart',
    '/pay',
    '/mine'
]

router.beforeEach((to,from) => {
    if (permissionRoute.includes(to.path)) {
        if (store.getters.token && localStorage.getItem('vuex')) {
            return true
        } else if(to.path==='/cart'){
            return '/login?cart=1'
        } else {
            return '/login'
        }
    }
})